<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
   	<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>

<script type="text/javascript">
function getPageNumber(writerNo){
	var page=1;
	for(var i=1;i<=100;i++){
		if(writerNo<=(i*10)){
			page = i;
			return page;
		}
	}
}
function memberDelete(id,writerNo){
 
	 
	var page = getPageNumber(writerNo);
	alert(id+"님이 강제 탈퇴되었습니다.");
	var form = document.adminForm;
	 
	form.action = "/${initParam.context_root}/adminMemberDelete.do?id="+id+"&page="+page;

	form.method = "post";
	form.submit();
}
function companyDelete(id,writerNo){
	 
	var page = getPageNumber(writerNo);
	
	alert(id+"님이 강제 탈퇴되었습니다.");
	var form = document.adminForm;
	form.action = "/${initParam.context_root}/adminCompanyDelete.do?id="+id+"&page="+page;
	form.method = "post";
	form.submit();
}
function memberReceive(id,writerNo){
	 
	var page = getPageNumber(writerNo);
	
	 
	alert(id+"님이 탈퇴가 취소되었습니다.");
	var form = document.adminForm;
	form.action = "/${initParam.context_root}/adminMemberReceive.do?id="+id+"&page="+page;

	form.method = "post";
	form.submit();
}
function companyReceive(id,writerNo){
	 
	var page = getPageNumber(writerNo);
	
	alert(id+"님이 탈퇴가 취소되었습니다.");
	var form = document.adminForm;
	form.action = "/${initParam.context_root}/adminCompanyReceive.do?id="+id+"&page="+page;
	form.method = "post";
	form.submit();
}
</script>
<form name="adminForm">
<input type="hidden" name="choiceMember" value="${requestScope.choiceMember }"> 
<c:if test="${requestScope.getAllMember.list !=null}">
관리자 회원관리페이지 입니다.<p>
<hr>
<table cellpadding="5" cellspacing="0" border="1" >
<tr bgcolor="lightgray"><td>순번</td><td>회사명</td><td>이름</td><td>주소</td><td>전화번호</td><td>마일리지</td><td>신용도</td><td>가입유무(O(가입),X(탈퇴))</td><td>이메일</td><td bgcolor="lightgray">&nbsp;</td><td bgcolor="lightgray">&nbsp;</td></tr>

<c:forEach items="${requestScope.getAllMember.list}" var="list" varStatus="i">

<tr><td>${i.count }</td><td>${list.id }</td><td>${list.name }</td><td>${list.address }</td><td>${list.phone }</td><td>${list.mileage }</td><td>${list.credit }</td><td>${list.is_validate }</td><td>${list.email }</td><td bgcolor="lightgray"><input type="button" value="강제탈퇴" onclick="memberDelete('${list.id}',${i.count })"></td><td bgcolor="lightgray"><input type="button" value="탈퇴취소" onclick="memberReceive('${list.id}',${i.count })"></td></tr>
</c:forEach>
</table>
<table>
		<tr><td>
		<c:choose >
		<c:when test="${ requestScope.getAllMember.pageDTO.previousPageGroup }"> 
			<a href="/${initParam.context_root }/selectMemberListByPage.do?page=${requestScope.getAllMember.pageDTO.currentPage -1}">◀</a>
		</c:when>
		<c:otherwise>◀</c:otherwise>
		</c:choose>
		<c:forEach begin="${requestScope.getAllMember.pageDTO.startPageOfPageGroup }" end="${requestScope.getAllMember.pageDTO.endPageOfPageGroup }" step="1" varStatus="i">
			&nbsp;<font color=orange><B><a href="/${initParam.context_root }/selectMemberListByPage.do?page=${i.count }&choiceMember=${requestScope.choiceMember}">${i.count }</a></B></font>&nbsp;&nbsp;	
		</c:forEach>
		<c:choose >
		<c:when test="${ requestScope.getAllMember.pageDTO.nextPageGroup }"> 
			<a href="/${initParam.context_root }/selectMemberListByPage.do?page=${requestScope.getAllMember.pageDTO.currentPage +1 }">▶</a>
		</c:when>
		<c:otherwise>▶</c:otherwise>
		</c:choose>
		</td></tr>
</table>

</c:if>
<c:if test="${requestScope.getAllCompany.list !=null}">
관리자 기업관리페이지 입니다.<p>
<hr>
<table cellpadding="5" cellspacing="0" border="1" >
<tr bgcolor="lightgray"><td><b>순번</b></td><td><b>회사명</b></td><td><b>사업번호</b></td><td><b>이름</b></td><td><b>주소</b></td><td><b>전화번호</b></td><td><b>마일리지</b></td><td><b>신용도</b></td><td><b>가입유무(O(가입),X(탈퇴))</b></td><td><b>이메일</b></td><td bgcolor="lightgray">&nbsp;</td><td bgcolor="lightgray">&nbsp;</td></tr>
<c:forEach items="${requestScope.getAllCompany.list}" var="list" varStatus="i">

<tr><td>${i.count }</td><td>${list.id }</td><td>${list.businessNo }</td><td>${list.name }</td><td>${list.address }</td><td>${list.phone }</td><td>${list.mileage }</td><td>${list.credit }</td><td>${list.is_validate }</td><td>${list.email }</td><td bgcolor="lightgray"><input type="button" value="강제탈퇴" onclick="companyDelete('${list.id }',${i.count })"></td><td bgcolor="lightgray"><input type="button" value="탈퇴취소" onclick="companyReceive('${list.id }',${i.count })"></td></tr>
</c:forEach>
</table>
<table>
		<tr><td>
		<c:choose >
		<c:when test="${ requestScope.getAllCompany.pageDTO.previousPageGroup }"> 
			<a href="/${initParam.context_root }/selectMemberListByPage.do?page=${requestScope.getAllCompany.pageDTO.currentPage -1}">◀</a>
		</c:when>
		<c:otherwise>◀</c:otherwise>
		</c:choose>
		<c:forEach begin="${requestScope.getAllCompany.pageDTO.startPageOfPageGroup }" end="${requestScope.getAllCompany.pageDTO.endPageOfPageGroup }" step="1" var="i">
			&nbsp;<font color=orange><B><a href="/${initParam.context_root }/selectMemberListByPage.do?page=${i }&choiceMember=${requestScope.choiceMember}">${i }</a></B></font>&nbsp;&nbsp;	
		</c:forEach>
		<c:choose >
		<c:when test="${ requestScope.getAllCompany.pageDTO.nextPageGroup }"> 
			<a href="/${initParam.context_root }/selectMemberListByPage.do?page=${requestScope.getAllCompany.pageDTO.currentPage +1 }">▶</a>
		</c:when>
		<c:otherwise>▶</c:otherwise>
		</c:choose>
		</td></tr>
</table>
</c:if>
</form>
